home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / misc.818 < prev    next >
Text File  |  1992-02-06  |  3KB  |  74 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f2\fmodern Courier;\f1\fswiss Helvetica;}
  2. \paperw12940
  3. \paperh9000
  4. \margl120
  5. \margr1000
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ul0\fs28\fc0 MallocDebug known problems
  8. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
  9. \
  10. Q:  When linking my program with 
  11. \b MallocDebug
  12. \b0 ,  I got the error message "
  13. \f2\fs24 failed on vm_allocate
  14. \f0\fs28 "  in the console when I tried to allocate  43 MB.  However, if I relink the exact same program without the 
  15. \b MallocDebug
  16. \b0  library,  it will run fine.  Why?\
  17. \
  18. Q:  When linking in 
  19. \b MallocDebug
  20. \b0 , I noticed that my program  VSIZE (using 
  21. \b ps -ux
  22. \b0 )  which was 2MB without 
  23. \b MallocDebug
  24. \b0 , would start out way high—well over 20MB.  Why?\
  25. \
  26. A:  
  27. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 The problem is that 
  28. \b MallocDebug
  29. \b0  requires all of the memory to be allocated contiguously, which means that it must guess how much the program might need and allocate all of that at once at
  30. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0  the
  31. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0  beginning  The current gue
  32. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0 s
  33. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 timate is 40
  34. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0  
  35. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 M
  36. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0 B
  37. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 .  
  38. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0 This is the reason why when running your program with 
  39. \b MallocDebug
  40. \b0 , you have noticed that the VSIZE went up tremendously.\
  41.  
  42. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 \
  43. So if you use 
  44. \b MallocDebug
  45. \b0 ,  you can only ask for a total of 40 MB over the life of your program. After you cross that,  it will fail.  It doesn't matter if you have freed any or all of the memory you have previously asked for.  The indicative error message is : 
  46. \f2\fs24 "failed on vm_allocate"
  47. \f0\fs28  when you try to use 
  48. \b malloc()
  49. \b0 ,
  50. \b   calloc()
  51. \b0 ,
  52. \b  
  53. \b0 or
  54. \b  realloc()
  55. \b0 .  \
  56. \
  57. There is no workaround other than running your program without using 
  58. \b MallocDebug
  59. \b0 . \
  60.  
  61. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 Note also that 
  62. \b MallocDebug
  63. \b0  cannot currently  be used together with 
  64. \b ProcessMonitor
  65. \b0 .\
  66. \
  67.  
  68. \fc0 QA818\
  69. \
  70. Not Valid for 1.0\
  71. Valid for 2.0\
  72. \
  73.  
  74.